forgottenrealmsfandomcom_pt_br-20200215-history
Predefinição:Formato imagem em destaque.índice/doc
Esta página contém a documentação para a função Predefinição:Imagem em destaque/índice e a sua predefinição fantasma Predefinição:Formato imagem em destaque.índice. Imagem em destaque/índice The Imagem em destaque index is a handy sortable table of all the images that have been used in the set of featured image files (see the links on Template:Imagem em destaque/doc). It is generated by the following DPL function: The first line limits the search for pages to the Template namespace (i.e., the names start with "Template:"). The second line tells DPL to look for pages that use the template, which is how featured images are designated. The third line tells DPL to call the phantom template (described below) with all the same parameters that were used in on the pages it just found. The fourth line tells DPL to present the output of the phantom template as a table, with the given CSS classes, and column headings. The last line specifies that the table should be initially sorted by the 2nd column, which is Image Name. Formato imagem em destaque.índice This template is what's called a surrogate template or phantom template in DPL parlance. The function calls this template every time it finds an instance of in its searching. This template is called with the same parameters as the template invocations that it finds, i.e., the image, caption, and usethis parameters from each featured image page. Two additional parameters are passed to this template, named %PAGE% and %TITLE%, which evaluate to the full page name and the page title respectively. Here is the important part of the template: }}}}}|:|1}} | }}}}}|75px | }}} | }|/|1}}}} As you can see, it uses a lot. This is a string parser function that breaks a string at a given delimiter and returns one of the pieces specified by a position number. First piece is number zero, next is one, and so on. See the documentation on string functions for more detail. By the time this template is called, a wikitable has already been started, and all we have to do is return a row of data. Actually, the first column (a link to the featured image file) has already been generated by the index function, so we are returning columns 2 through 5 (Image Name, Thumbnail, When, and DOY). ;Image Name : the value of image should be something like , so first we extract the text of the link with and . Rootlink removes everything from the pipe (" | " if there is one) to the end, and unlink removes any square brackets. After this we should have File:ImageFoo.jpg and we explode that using the colon (" : ") as the delimiter. Choosing the second piece (piece 1) of that gives just the image file name ImageFoo.jpg. ;Thumbnail : Same rootlink/unlink used above gives File:ImageFoo.jpg to which we prefix 75px to make a small thumbnail version of the image. ;When : We present the value of the usethis parameter in upper case, just because. ;DOY : The %TITLE% parameter evaluates to the name of the file found by the calling template, not including the namespace, Imagem em destaque/22 April for example. We explode this at the forward slash (" / ") and take the second piece which in the example would be 22 April. We give this to the function and it returns the Day Of Year (it assumes the current year). Apêndice Category:Documentação de predefinição